<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?>
<title><?= $sf_response->getTitle() ?></title>
<?php use_stylesheet('/sf/sf_admin/css/main');?>

<div id="sf_admin_container">
<h1>Component List<? echo isset($code)? " of ".$code:''?></h1>
<div id="sf_admin_content">
<table id ='added_components' "cellspacing="0" class="sf_admin_list">
<thead>
<tr>
      <th id="sf_admin_list_th_productcode" width="20%">Product Code
              </th>
      <th id="sf_admin_list_th_description" width="30%">Description
              </th>
      <th id="sf_admin_list_th_description" width="7%">Brand
              </th>       
      <th id="sf_admin_list_th_description" width="7%">Unit
              </th>

      <th id="sf_admin_list_th_description">Qty Need</th>
      <th id="sf_admin_list_th_description">Qty Requested</th>
      <th id="sf_admin_list_th_description">Qty Outstanding</th>
      <th id="sf_admin_list_th_description">Supplied by Client</th>
</tr>
</thead>
<!--show component here-->
<?php  
    foreach ($componentsList as $key=>$components) { 
        $component1= ComponentPeer::retrieveByPK($components->getComponentId());
        $MRcomps = null;
        if ($mr && $mr->getComponentgroupId()){
            $c= new Criteria();
            $c->add(ComponentsPeer::COMPONENT_ID, $component1->getId());
            $c->add(ComponentsPeer::COMPONENTGROUP_ID, $mr->getComponentgroupId());
            $MRcomps = ComponentsPeer::doSelectOne($c);            
        }
        ?>
        <tr class="sf_admin_row_<?php echo $key%2?>">
            <input type="hidden" name="rowIds[]" id ="rowIds"  class = "ExistComponents" value="<? echo $component1->getId()?>"/>
            <td><?echo $component1->getProductcode()?></td>
            <td><?echo $component1->getDescription()?></td>
            <td><?echo $component1->getBrand()?></td>
            <td><?echo $component1->getComponentunit()?></td>
            <td><input type="text" name="qtys[]" id ="qtys" size="5" disabled value ="<?echo $components->getQty1()?>"></td>
            <td><input type="text" name="qtys[]" id ="qtys" size="5" disabled value ="<?echo $MRcomps? $MRcomps->getQty1():''?>"></td>
            <td><input type="text" name="qtys[]" id ="qtys" size="5" disabled value ="<?echo $components->getQty4()?>"></td>
            <td><input type="checkbox" name="suppliedByClients[]" id ="suppliedByClients"  disabled value="<?php echo $components->getComponentId();?>"  <?php if (1 == $components->getQty2()) echo "checked"?>></td>            
        </tr>
<?php } ?>
</table>

<ul class="sf_admin_actions"><li>
<?php echo button_to('back', 'bom/list', array (
  'class' => 'sf_admin_action_back')) ?>
</li></ul>

</div>
</div>